//发送一个请求结构 接口规定 必须要带token
axios.get('/student/list')
const logout = document.querySelector('.logout');
logout.addEventListener('click',function(e){
    if (confirm('您确定要退出吗')) {
        location.href='./login.html'
        localStorage.removeItem('upUp')
    }
})

//一级菜单点击功能
const oneListMenu= document.querySelectorAll('.nav>li>a')
oneListMenu.forEach(v=>{
    v.addEventListener('click',function(e){
        v.querySelector('.toggle').classList.toggle('toggleOne')
        v.nextElementSibling.classList.toggle('show')
    })
    
})
//二级菜单点击功能
const twoListMenu = document.querySelectorAll('.nav ul a')
twoListMenu.forEach(v=>{
    v.addEventListener('click',function(){
        document.querySelector('.nav ul a.active').classList.remove('active')
        v.classList.add('active')
    })
})

//初始化数据
const init = document.querySelector('.init')
init.addEventListener('click',function(e){
    axios.get('/init/data').then(result=>{if (result.data.code===0) {
        toastr.success(result.data.message)
    }})
})

